package com.qianbao.qianbaobusiness.ui.deposit;

import com.androidbase.base.mvp.RxMvpPresenter;
import com.androidbase.utils.RxUtils;
import com.baseandroid.config.MyApi;
import com.baseandroid.retrofit.RxObserver;
import com.baseandroid.retrofit.json.Data;
import com.qianbao.qianbaobusiness.json.UnPayShopListBean;

import javax.inject.Inject;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

public class DepositToH5Present extends RxMvpPresenter<DepositToH5View>{
    MyApi myApi ;

    @Inject
    public DepositToH5Present(MyApi myApi) {
        this.myApi = myApi;
    }

    public void getMerchantUnpayDepositInfo(String merchantNos) {
        myApi.getMerchantUnpayDepositInfo(merchantNos)
                .compose(RxUtils.applySchedulersLifeCycle(getView()))
                .subscribe(new Observer<Data<UnPayShopListBean>>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(Data<UnPayShopListBean> merchantUnpayDepositInfoBeanData) {
                        if (RxObserver.checkJsonCode(merchantUnpayDepositInfoBeanData, false)) {
                            getView().getMerchantSuccess(merchantUnpayDepositInfoBeanData.getResult());
                        }
                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onComplete() {

                    }
                });
}}
